package topday1_9.chj;

/**
 * @Auther:小陈的Java
 */
public class MethodDome {
    void reverse(int[] array) {
        for (int i=0;i<array.length/2;i++) {
            int temp = array[i];
            array[i] = array[array.length-i-1];
            array[array.length-i-1] = temp;
        }
        for(int i=0;i<array.length;i++){
            System.out.print(array[i]+"\t");
        }
        System.out.println();
    }
    void sort(int[] array) {
        for(int i=0;i<array.length-1;i++){
            for(int j=0;j<array.length-1-i;j++){
                if(array[j]>array[j+1]){
                    int s = array[j];
                    array[j] = array[j+1];
                    array[j+1] = s;
                }
            }
        }
        for(int i=0;i<array.length;i++){
            System.out.print(array[i]+"\t");
        }
        System.out.println();
    }
    public static void main(String[] args) {
        int[] array = {2,14,3,21,8,3,5};
        MethodDome methodDome = new MethodDome();
        methodDome.reverse(array);
        methodDome.sort(array);

    }
}

